home *** CD-ROM | disk | FTP | other *** search
/ Freelog 22 / freelog 22.iso / Prog / Djgpp / DJDEV203.ZIP / include / netinet / in.h
Encoding:
C/C++ Source or Header  |  1998-07-12  |  1.0 KB  |  48 lines

  1. /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
  2. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  3. #ifndef __dj_include_netinet_in_h_
  4. #define __dj_include_netinet_in_h_
  5.  
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9.  
  10. #ifndef __dj_ENFORCE_ANSI_FREESTANDING
  11.  
  12. #ifndef __STRICT_ANSI__
  13.  
  14. #ifndef _POSIX_SOURCE
  15.  
  16. unsigned long  htonl(unsigned long _val);
  17. unsigned long  ntohl(unsigned long _val);
  18. unsigned short htons(unsigned short _val);
  19. unsigned short ntohs(unsigned short _val);
  20.  
  21. #endif /* !_POSIX_SOURCE */
  22. #endif /* !__STRICT_ANSI__ */
  23. #endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
  24.  
  25. #ifndef __dj_ENFORCE_FUNCTION_CALLS
  26.  
  27. extern __inline__ unsigned long
  28. htonl(unsigned long _val)
  29. {
  30.   return (_val << 24) | ((_val&0xff00) << 8) | ((_val&0xff0000) >> 8) | (_val >> 24);
  31. }
  32. #define ntohl(x) htonl(x)
  33.  
  34. extern __inline__ unsigned short
  35. htons(unsigned short _val)
  36. {
  37.   return (_val << 8) | (_val >> 8);
  38. }
  39. #define ntohs(x) htons(x)
  40.  
  41. #endif /* !__dj_ENFORCE_FUNCTION_CALLS */
  42.  
  43. #ifdef __cplusplus
  44. }
  45. #endif
  46.  
  47. #endif /* !__dj_include_netinet_in_h_ */
  48.